package com.hsgene.order.constants.v1;

/**
 * 订单积分发放状态
 *
 * @author wangbing
 * @version 1.0
 * @date 2019/1/4 15:10
 * Copyright: Copyright (c) 2019
 */
public enum OrderPointSendStatus {

    /**
     * 订单积分发放状态
     */
    SENDING_POINT("sending_point", "待发放积分"),

    SENDING_POINT_APPLY("sending_point_apply", "积分申请发放中"),

    SEND_POINT_COMPLETE("send_point_complete", "已发放积分"),

    UNDEFINED("undefined", "未知状态");

    private final String value;

    private final String desc;

    OrderPointSendStatus(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static OrderPointSendStatus getEnum(String value) {
        for (OrderPointSendStatus status : values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }

        return UNDEFINED;
    }

    /**
     * 订单积分是否已经发放
     *
     * @return 发放成功为已发放：true； 其它均为未发放：false
     */
    public boolean isPointSent() {
        return this.equals(SEND_POINT_COMPLETE);
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
}
